import { Inject, Get, Query } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { OrderCityEntity } from '../../entity/city';
import { OrderCityService } from '../../service/city';
import { OrderDataboardService } from '../../service/databoard';

/**
 * 订单模块-店铺信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: OrderCityEntity,
  service: OrderCityService,
  pageQueryOp: {
    keyWordLikeFields: ['a.cityName'],
  },
})
export class AdminOrderCityController extends BaseController {
  @Inject()
  orderCityService: OrderCityService;

  @Inject()
  orderDataboardService: OrderDataboardService;

  @Get('/getCityList')
  async getCityList() {
    return this.ok(await this.orderCityService.getSelectList());
  }

  @Get('/tongkangShopBoard')
  async tongkangShopBoard(@Query() query: any) {
    return this.ok(await this.orderDataboardService.tongkangShopBoard(query));
  }
}
